
#include "head.h"
void start(void)
{
  //setlocale(LC_ALL, "C");
  setlocale(LC_ALL, "");
  const char *art[] = {
      "    ______                                                                     ",
      "    L,.   ',                                                                   ",
      "     \\      ',_                            ",
      "      \\   @   ',                                                               ",
      "       \\ ^~^    ',                                                             ",
      "        \\         ',                                                           ",
      "         \\___'____  ',_                          _..----.._                    ",
      "         [______       \"'==.I\\_____________..--\"<__\\_n@___4\\,_                ",
      "       ,..-=T         __   ____________          \\/  \"'\" 0<==  \"'-+.._         ",
      "       I____|_____    }_>=========I>=**\"\"''==-------------==-   \" |   \"'-.,___",
      "     [_____,.--'\"                             \"\"--=<\"\"-----=====+==--''\"\"      ",
      "       \"'-=+..,,__,-----,_____                  -=* |                         ",
      "                   |__   /-----'#------.,I_---------'\"                         ",
      "                      \"\"\"\"'\"--..__         _.>                                  ",
      "                                 \"\"\"\"\"\"\"\"        "};
  initscr();   // Initialize the screen
  cbreak();    // Disable line buffering
  noecho();    // Don't echo input
  curs_set(0); // Hide the cursor

  int max_y, max_x;
  getmaxyx(stdscr, max_y, max_x); // Get the screen dimensions

  int art_height = sizeof(art) / sizeof(art[0]);
  int art_width = 0;
  for (int i = 0; i < art_height; i++)
  {
    if (strlen(art[i]) > art_width)
    {
      art_width = strlen(art[i]);
    }
  }

  int offset = 0;
  int frame_count = 0;
  const int max_frames = 100; // Number of frames to display the animation

  while (frame_count < max_frames)
  {
    clear(); // Clear the screen
    for (int i = 0; i < art_height; i++)
    {
      mvprintw(max_y / 2 + i - art_height / 2, offset, "%s", art[i]);
    }
    refresh();                                   // Refresh the screen
    offset = (offset + 1) % (max_x + art_width); // Move the art to the right
    usleep(30 * 1000);                              // Sleep for 30 milliseconds
    frame_count++;
  }
  setlocale(LC_ALL, "C");
  endwin(); // End ncurses
}

